<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
	<style 	type="text/css">
		.box{
			width: 400px;
			height: 400px;
			background: red url() 0 0 no-repeat;
		}
	</style>
	<script type="text/javascript">
		window.onload = function  () {
			var box = document.getElementById('box');

			// var box = document.getElementsByClassName('box')

			box.onmouseover = function  () {

				box.style.backgroundColor='blue';
			}

			box.onclick = function  () {

				box.style.backgroundColor='green';
			}

			box.onmouseout  = function  () {

				box.style.backgroundColor='red';
			}

			var username = document.getElementById('username');

			username.onblur = function  () {
				// alert('失焦')
			}

			username.onfocus = function  () {
				
			}

			username.onkeydown = function  () {
				alert('你按了我一下')
			}


		}

	</script>

</head>
<body>
	<div class="box"  id='box'></div>
	<input type="text" id="username">
</body>
</html>